package com.lishe.lishe.lishe.module.mall.bean;

import android.util.SparseArray;

import java.io.Serializable;
import java.util.LinkedList;

/**
 * Created by shino on 2017/9/16.
 * 商品类型的商品对象
 */

public class MallGoods implements Serializable {

    //--------------type=------------------
    private String approve_status;//商品状态：instock：下架，onsale：上架
    private String is_offline;
    private String mkt_price;//折前
    private String shop_id;
    //--------------type=2------------------
    private String image_default_id;
    private String item_id;
    private String price;//折后
    private String title;
    private String brand;//品牌
    private String weight;//毛重
    private String kucun;//库存-对应store
    private String sku_id;
    private String jd_ids;//-jd_sku
    private double discount;//打折
    private String cat_id;
    private SparseArray<Discount> discountList = new SparseArray<>();//促销信息数组

    public static class Discount implements Serializable {

        private String title;

        public Discount(String title) {
            this.title = title;
        }

        public String getTitle() {
            return title;
        }

    }

    public SparseArray<Discount> getDiscountList() {
        return discountList;
    }

    public void setDiscountList(SparseArray<Discount> discountList) {
        this.discountList = discountList;
    }

    public String getCat_id() {
        return cat_id;
    }

    public void setCat_id(String cat_id) {
        this.cat_id = cat_id;
    }

    private LinkedList<MallGoods> items = new LinkedList<>();//商品下的item

    public String getImage_default_id() {
        return image_default_id;
    }

    public void setImage_default_id(String image_default_id) {
        this.image_default_id = image_default_id;
    }

    public String getItem_id() {
        return item_id;
    }

    public void setItem_id(String item_id) {
        this.item_id = item_id;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getApprove_status() {
        return approve_status;
    }

    public void setApprove_status(String approve_status) {
        this.approve_status = approve_status;
    }

    public String getIs_offline() {
        return is_offline;
    }

    public void setIs_offline(String is_offline) {
        this.is_offline = is_offline;
    }

    public String getMkt_price() {
        return mkt_price;
    }

    public void setMkt_price(String mkt_price) {
        this.mkt_price = mkt_price;
    }

    public String getShop_id() {
        return shop_id;
    }

    public void setShop_id(String shop_id) {
        this.shop_id = shop_id;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getKucun() {
        return kucun;
    }

    public void setKucun(String kucun) {
        this.kucun = kucun;
    }

    public String getSku_id() {
        return sku_id;
    }

    public void setSku_id(String sku_id) {
        this.sku_id = sku_id;
    }

    public String getJd_ids() {
        return jd_ids;
    }

    public void setJd_ids(String jd_ids) {
        this.jd_ids = jd_ids;
    }

    public LinkedList<MallGoods> getItems() {
        return items;
    }

    public void setItems(LinkedList<MallGoods> items) {
        this.items = items;
    }

    public double getDiscount() {
        if (Double.parseDouble(mkt_price) > 0) {
            discount = Double.parseDouble(price) / Double.parseDouble(mkt_price);
        }
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }
}
